﻿<%@ Register TagPrefix="ucCommon" TagName="Common" Src="../Common/Inc/Common.ascx" %>
<%@ Register TagPrefix="ucComment" TagName="Comment" Src="../Common/Inc/Comment.ascx" %>
<%@ Register TagPrefix="ucTop" TagName="Top" Src="../Common/Inc/Top.ascx" %>
<%@ Register TagPrefix="ucMenu" TagName="Menu" Src="../Common/Inc/Menu.ascx" %>
<%@ Register TagPrefix="ucTabTitle" TagName="TabTitle" Src="../Common/Inc/TabTitle.ascx" %>
<%@ Register TagPrefix="ucCopyright" TagName="Copyright" Src="../Common/Inc/Copyright.ascx" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Com1012m.aspx.cs" Inherits="Updms.Com.Com1012m" EnableEventValidation="false" validateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>▒ UPDMS [Com1012m] ▒▒▒▒▒▒▒▒▒▒</title>
<ucCommon:Common id="Common" runat="server"></ucCommon:Common>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="ScriptManager1" EnableScriptGlobalization="true"></asp:ScriptManager>
<table id="table_frame">
	<tr>
		<td id="top_area" colspan="2">
			<!-- Top 시작 -->
			<ucTop:Top id="Top" runat="server"></ucTop:Top>
			<!-- Top 끝 -->
		</td>
	</tr>
	<tr>
		<td id="menu_area">
			<!-- 메뉴 시작 -->
			<ucMenu:Menu id="Menu" runat="server"></ucMenu:Menu>
			<!-- 메뉴 끝 -->
		</td>
		<td id="contents_area">
			<!-- 제목 시작 -->
			<ucTabTitle:TabTitle id="TabTitle" TagPrefixs="Com1012m" runat="server"></ucTabTitle:TabTitle>
			<!-- 제목 끝 -->
			<!-- AJAX 시작 -->
			<asp:UpdatePanel ID="UpdatePanel1" runat="server">
			<ContentTemplate>
			<!-- 버튼 시작 -->
			<div class="button_area">
				<asp:linkbutton id="ibtn_save" Text="저장" runat="server" CssClass="ibtn ibtn_save" OnClientClick="return chkSave()" OnClick="ibtn_save_Click"></asp:linkbutton>
				<asp:linkbutton id="ibtn_search" Text="검색" runat="server" CssClass="ibtn ibtn_search" OnClick="ibtn_search_Click"></asp:linkbutton>
			</div>
			<!-- 버튼 끝 -->
			<!-- 검색 시작 -->
			<!-- 검색 끝 -->
			<!-- 디테일1 시작 -->
			<table class="default">
				<tr>
					<td width="33%" valign="top">
						<table class="default">
							<tr>
								<td><div class="sub_title_icon"><asp:Literal ID="ltr_sub_title_program" Text="프로그램" runat="server" /></div></td>
							</tr>
							<tr>
								<td class="td_box_mst"><asp:listbox id="lbox_left" runat="server" width="100%" height="600" SelectionMode="Multiple" CssClass="che"></asp:listbox></td>
							</tr>
						</table>
					</td>
					<td>&nbsp;</td>
					<td width="33%" valign="top">
						<!-- Super Administrator 시작 -->
						<table class="default">
							<tr>
								<td><div class="sub_title_icon">Super Administrators</div></td>
								<td>
									<asp:LinkButton id="lbtn_del_sa" class="sbtn sbtn_del div_right" runat="server" ToolTip="삭제" OnClientClick="clearSelectedListBox('1');return false;" />
									<asp:LinkButton id="lbtn_add_sa" class="sbtn sbtn_add div_right" runat="server" ToolTip="추가" OnClick="lbtn_add_sa_Click" />
								</td>
							</tr>
							<tr>
								<td class="td_box" colspan="2"><asp:listbox id="lbox_right_1" runat="server" width="100%" height="600" SelectionMode="Multiple" CssClass="che"></asp:listbox></td>
							</tr>
						</table>
						<!-- Super Administrator 끝 -->
					</td>
					<td>&nbsp;</td>
					<td width="33%" valign="top">
						<!-- Administrators 시작 -->
						<table class="default">
							<tr>
								<td><div class="sub_title_icon">Administrators</div></td>
								<td>
									<asp:LinkButton id="lbtn_del_a" class="sbtn sbtn_del div_right" runat="server" ToolTip="삭제" OnClientClick="clearSelectedListBox('2');return false;" />
									<asp:LinkButton id="lbtn_add_a" class="sbtn sbtn_add div_right" runat="server" ToolTip="추가" OnClick="lbtn_add_a_Click" />
								</td>
							</tr>
							<tr>
								<td class="td_box" colspan="2"><asp:listbox id="lbox_right_2" runat="server" width="100%" height="250" SelectionMode="Multiple" CssClass="che"></asp:listbox></td>
							</tr>
							<tr>
								<td colspan="2" height="12"></td>
							</tr>
						</table>
						<!-- Administrators 끝 -->
						<!-- Readers 시작 -->
						<table class="default">
							<tr>
								<td><div class="sub_title_icon">Readers</div></td>
								<td>
									<asp:LinkButton id="lbtn_del_r" class="sbtn sbtn_del div_right" runat="server" ToolTip="삭제" OnClientClick="clearSelectedListBox('3');return false;" />
									<asp:LinkButton id="lbtn_add_r" class="sbtn sbtn_add div_right" runat="server" ToolTip="추가" OnClick="lbtn_add_r_Click" />
								</td>
							</tr>
							<tr>
								<td class="td_box" colspan="2"><asp:listbox id="lbox_right_3" runat="server" width="100%" height="150" SelectionMode="Multiple" CssClass="che"></asp:listbox></td>
							</tr>
							<tr>
								<td colspan="2" height="8"></td>
							</tr>
						</table>
						<!-- Readers 끝 -->
						<!-- Common Users 시작 -->
						<table class="default">
							<tr>
								<td><div class="sub_title_icon">Common Users</div></td>
								<td>
									<asp:LinkButton id="lbtn_del_cu" class="sbtn sbtn_del div_right" runat="server" ToolTip="삭제" OnClientClick="clearSelectedListBox('4');return false;" />
									<asp:LinkButton id="lbtn_add_cu" class="sbtn sbtn_add div_right" runat="server" ToolTip="추가" OnClick="lbtn_add_cu_Click" />
								</td>
							</tr>
							<tr>
								<td class="td_box" colspan="2"><asp:listbox id="lbox_right_4" runat="server" width="100%" height="106" SelectionMode="Multiple" CssClass="che"></asp:listbox></td>
							</tr>
							<tr>
								<td colspan="2" height="10"></td>
							</tr>
						</table>
						<!-- Common Users 끝 -->
					</td>
				</tr>
			</table>
			<!-- 디테일1 끝 -->
			<!-- 설명 시작 -->
				<ucComment:Comment id="Comment" runat="server" TagPrefixs="Com1012m"></ucComment:Comment>
			<!-- 설명 끝 -->
			<!-- 카피라이트 시작 -->
			<ucCopyright:Copyright id="Copyright" runat="server"></ucCopyright:Copyright>
			<!-- 카피라이트 끝 -->
			<!-- 히든값 시작 -->
			<div id="hdn_data">
			<asp:label id="lbl_pk" runat="server"></asp:label>
			<asp:Label id="lbl_search_flag" runat="server"></asp:Label>
			<input id="h_save_data" type="hidden" name="h_save_data" runat="server" />
			</div>
			<!-- 히든값 끝 -->
			</ContentTemplate>
			</asp:UpdatePanel>
			<!-- AJAX 끝 -->
		</td>
	</tr>
</table>

<asp:updateprogress AssociatedUpdatePanelID="UpdatePanel1" ID="updateProgress" runat="server">
	<progresstemplate>
		<div id="progressBackgroundFilter"></div>
		<div id="processMessage">
			<div id="processing"></div>
			<img src="../Common/Images/processing_img.gif" />
		</div>
	</progresstemplate>
</asp:updateprogress>

</form>
<script type="text/javascript" language="javascript" defer="defer">
	//저장
	function chkSave() {
		var form = document.form1;

		var node_1 = "";
		for (var i = 0; i < form.lbox_right_1.options.length; i++)
		{
			var temp = form.lbox_right_1[i].value;
			
			if (temp != "D")
			{
				var Pgm_Id = "<Pgm_Id>" + temp + "</Pgm_Id>";
				var User_Div = "<User_Div>AA007</User_Div>";
				node_1 += "<TBL>" + Pgm_Id + User_Div + "</TBL>";
			}
		}

		var node_2 = "";
		for (var i = 0; i < form.lbox_right_2.options.length; i++)
		{
			var temp = form.lbox_right_2[i].value;
			
			if (temp != "D")
			{
				var Pgm_Id = "<Pgm_Id>" + temp + "</Pgm_Id>";
				var User_Div = "<User_Div>AA006</User_Div>";
				node_2 += "<TBL>" + Pgm_Id + User_Div + "</TBL>";
			}
		}

		var node_3 = "";
		for (var i = 0; i < form.lbox_right_3.options.length; i++)
		{
			var temp = form.lbox_right_3[i].value;
			
			if (temp != "D")
			{
				var Pgm_Id = "<Pgm_Id>" + temp + "</Pgm_Id>";
				var User_Div = "<User_Div>AA005</User_Div>";
				node_3 += "<TBL>" + Pgm_Id + User_Div + "</TBL>";
			}
		}

		var node_4 = "";
		for (var i = 0; i < form.lbox_right_4.options.length; i++)
		{
			var temp = form.lbox_right_4[i].value;
			
			if (temp != "D")
			{
				var Pgm_Id = "<Pgm_Id>" + temp + "</Pgm_Id>";
				var User_Div = "<User_Div>AA004</User_Div>";
				node_4 += "<TBL>" + Pgm_Id + User_Div + "</TBL>";
			}
		}

		var save_data = "<UPDMS>" + node_1 + node_2 + node_3 + node_4 + "</UPDMS>";

		$("h_save_data").value = save_data;

		msgBox.confirm(getMsg(MSG_CFM_000), doSave);	//저장하시겠습니까?
		return false;
	}

	//그룹별 선택된 항목삭제
	function clearSelectedListBox(lb_id) {
		var lb = $('lbox_right_' + lb_id);
		for (var j = lb.options.length - 1; j >= 0; j--) {
			if (lb.options[j].selected == true) { lb.options[j] = null; }
		}
		lb.selectedIndex = -1;
	}
	
</script>
</body>
</html>